home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Loadstar 199
/
199.d81
/
hk3 bridge
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-08-26
|
24KB
|
698 lines
1 rem ***** hk bridge *****
5 dv=peek(186):ifdv<8thendv=8
40 sys57812"f.bridge",dv,0:poke780,0:poke781,0:poke782,8:sys65493
60 clr:dv=peek(186):ifdv<8thendv=8
100 rem ***** set variables *****
105 ad=49152:ag=4096:s=54272:poke53272,19:printchr$(14):printchr$(8)
110 a$="":at=0:b$="":bh$="":bd=0:bk=0:bl=0:c$="":cd%=0
115 ch=0:cs=0:ct=0:d=0:df$="":dl$="":dr=0:ds=0
120 f%=0:fl%=0:ft%=1000:gt=0:gw=0:k=0
130 ms$="":nm$="":pc%=0
135 q=0:q$=chr$(34):qf=0:rn%=0
140 sn%=0:p%=0:sz=0:tv%=0
145 v=0:w$="":x=0:y=0:z=0:zs=0:x$=""
150 dima$(24),gl$(99),l1%(48),l2%(48),md$(2,20),sd$(8),sp$(5),zl(5),pv$(3)
155 dimst%(48),ub%(48),fl$(9),vt%(3,4),fm%(3),ra$(3),wn$(2),we%(2),sl%(3)
156 dimev%(0),gl%(0),se%(0),sd%(0),sp%(0),rt%(0),lo%(0),gc%(0),ds%(0),fu%(0)
157 dimel%(0),fc%(0),ts%(0),ra%(0)
160 dl%(1)=1:dl%(2)=12:dl%(3)=24:dl$(1)="[211][197][195][212][207][210] =":dl$(2)=":[199][210][201][196] = "
165 dl$(3)=":%[198][213][197][204] =":hd$(1)="[204]iverpool":hd$(2)="[211]outhampton":
170 hd$(3)="[199]ibralter":hd$(4)="[201]celand":hd$(5)="[200]alifax"
175 sa%(1)=-1:sa%(2)=1:sa%(3)=-9:sa%(4)=9:sa%(5)=-10:sa%(6)=10:sa%(7)=-11
180 sa%(8)=11:fl$(1)=".af":fl$(2)=".ad":fl$(3)=".co":fl$(4)=".ca":fl$(5)=".cr"
185 fl$(6)=".lt":fl$(7)=".po":fl$(8)=".os":fl$(9)=".ld":kf$="[136][140][133][135][134]^_[138][139][137]*"
190 sd$(1)="[206]orth":sd$(2)="[206]-[197]":sd$(3)="[211]-[197]":sd$(4)="[211]outh":sd$(5)="[197]ast"
195 sd$(6)="[206]-[215]":sd$(7)="[211]-[215]":sd$(8)="[215]est"
196 sp$(1)="5 [203]nots":sp$(2)="10 [203]nots":sp$(3)="15 [203]nots":sp$(4)="20 [203]nots"
200 sd$(0)="[211]top":sp$(0)="zero":ra$(1)=".ec":ra$(2)=".pa":ra$(3)=".er"
205 vt%(1,4)=120:vt%(1,3)=180:vt%(1,2)=240:vt%(1,1)=300
210 vt%(2,4)=180:vt%(2,3)=240:vt%(2,2)=300:vt%(2,1)=360
215 vt%(3,4)=240:vt%(3,3)=300:vt%(3,2)=360:vt%(3,1)=420:fm%(1)=-10:fm%(2)=-20
220 wn$(1)="[196]epth [195]harges":wn$(2)="[200]edgehog [204]oads"
225 sl%(0)=0:sl%(1)=40:sl%(2)=30:sl%(3)=15
230 pv$(0)="":pv$(1)="3124^_":pv$(2)="3421^_":pv$(3)="1243^_"
800 rem ***** startup *****
805 print"[147]":ms$="[207]rganizing [206]avigation [205]aps.[144]":v=10:gosub5210
810 df$="game":dr=dv:gosub5115:ifpr<>3then5515
815 open3,dv,3,"l:"+df$:input#3,nm$,x$,a$:close3:ra%(0)=val(a$)
816 ifval(x$)>0then5520
817 gosub5740
820 gosub7705:ifqf<>1thengoto5515
825 df$="navigation data":dr=dv:gosub5115:ifpr<>3then5505
830 open3,dv,3,"l:"+df$+",p,r"
835 forx=0to1:fory=0to20:input#3,md$(x,y):next:next
840 forx=0to99:input#3,gl$(x):next:close3
1000 rem ***** bridge *****
1005 print"[147]":bd=1:bk=1:ch=0:gosub5005
1010 zs=2:gosub6105:ms$=md$(0,0):gosub5208
1015 h=8:forv=3to17:ms$=md$(0,v-2):gosub5070:next
1020 h=3:v=6:ms$="[193]<-":gosub5070:h=22:v=2:ms$="[216] = [194]":gosub5070
1021 h=32:v=6:ms$="->[195]":gosub5070:v=10:ms$="->[196]":gosub5070
1022 v=16:ms$="->[197]":gosub5070
1023 h=1:v=19:ms$="[193] = [200]alifax. [194] = [201]celand.":gosub5070
1024 v=20:ms$="[195] = [204]iverpool. [196] = [211]outhampton.":gosub5070
1025 v=21:ms$="[197] = [199]ibralter.":gosub5070
1030 gosub5225:ss=5:ss$="s":gosub5405
1032 gosub6955
1035 iflo%(0)<>0thenwe%(1)=100:we%(2)=100:fc%(0)=0:fu%(0)=100:rt%(0)=rt%(0)+1
1036 forx=1to7:onxgosub1405,1406,1410,1415,1420,1425,1430:next
1040 iflo%(0)=0thengosub1445:gosub1375:goto1060
1045 ms$="[217]ou are in "+hd$(lo%(0))+" [200]arbour.":gosub5208
1050 ms$="[193]ny key exits harbour.":cs=4:q=0:gosub5300:sp%(0)=1:gosub1185
1055 lo%(0)=0:forx=0to5:gosub1505:next:gosub1445:gosub1375
1060 gosub1805:gosub5034:ms$="[195]hange [195]ourse/[211]peed? (c/s)":zs=3
1100 ch$="cs":gosub6505:onqfgoto1105,1175,1100,1705,1100,3205,1170,1140,1035
1105 iff%=2then1125
1110 gosub5034:ms$="[195][207][213][210][211][197]: 1 = [206]orth, 2 = [206]ortheast,":gosub5209
1111 ms$="3 = [211]outheast, 4 = [211]outh, 5 = [197]ast,":gosub5206
1115 ms$="6 = [206]orthwest, 7 = [211]outhwest, 8 = [215]est.":gosub5205
1120 ch$="12345678":gosub6510:sd%(0)=f%:gosub1415:gosub5034:goto1060
1125 gosub5034:ms$="[211][208][197][197][196](knots): [193] = 5, [194] = 10,":gosub5206
1130 ms$="[195] = 15, [196] = 20.":gosub5205
1135 ch$="abcd":gosub6510:sp%(0)=f%:ifds%(0)<>0andsp%(0)>1thensp%(0)=sp%(0)-1
1137 gosub1420:gosub5034:goto1060
1140 gosub5034:mn%=sp%(0):fr=0
1145 gosub1390:ifqf=4thena%=0:goto1705
1146 gosub1505:onsd%(0)gosub3005,3105,3135,3035,3065,3575,3595,3155
1150 gosub3525:a=qf/2:onagoto1205,1705,3205,1035,1060
1155 gosub1450:mn%=mn%-1:gosub1235:ifmn%<1then1060
1160 goto1145
1170 gosub5034:gosub5380:goto5515
1175 gosub5034:gosub5380:goto5505
1185 onlo%(0)goto1186,1187,1188,1189,1190
1186 se%(0)=43:gl%(0)=19:sd%(0)=8:gosub1415:goto1420
1187 se%(0)=45:gl%(0)=49:sd%(0)=8:gosub1415:goto1420
1188 se%(0)=48:gl%(0)=89:sd%(0)=8:gosub1415:goto1420
1189 se%(0)=28:gl%(0)=5:sd%(0)=4:gosub1415:goto1420
1190 se%(0)=1:gl%(0)=40:sd%(0)=5:gosub1415:goto1420
1200 rem ***** lost convoy *****
1205 lv%=ev%(0)/2:ev%(0)=ev%(0)-lv%:gosub5034
1210 ms$="[217]ou loose "+str$(lv%)+" ships due to bad":gosub5206
1215 ms$="weather and faulty navigation.":gosub5205
1220 ms$="[195]ommand stops to regroup. [193]ny key.":cs=4:q=0:v=24:gosub5305
1225 gosub5034:sd%(0)=0:sp%(0)=0:goto1035
1230 rem ***** sailing problems *****
1235 e=1:ifst%(se%(0))=1andub%(se%(0))=1thene=3:b%=l1%(se%(0)):d%=l2%(se%(0)):goto1265
1240 ifst%(se%(0))=1thenb%=l1%(se%(0)):goto1265
1245 ifub%(se%(0))=1thend%=l2%(se%(0)):goto1270
1250 return
1260 rem ***** problem filter/action *****
1265 c%=0:a%=b%:d=1:a=0:gosub1290:ifa=1then1275
1270 c%=0:a%=d%:d=2:a=0:gosub1290:ifa=1then1275
1272 gosub5043:return
1275 gosub1305
1276 gosub6020:rn%=rnd(0)*4+1:ifrn%<>c%thenondgosub1355,1365
1280 ife=3andd=1then1270
1281 gosub5034:return
1290 ifgl%(0)=a%thenc%=2:a=1:return
1291 forx=1to8:ifgl%(0)=(a%+sa%(x))thenc%=1:x=8:next:a=1:return
1292 forx=1to8:ifgl%(0)=(a%-sa%(x))thenc%=1:x=8:next:a=1
1295 return
1300 rem ***** warnings/course change *****
1305 ms$="[217]ou are entering a storm.":cn=2
1310 ifd=2thenms$="[217]ou are in a [213]-boat area.":cn=4
1315 gosub2005:gosub5205:a%=rnd(0)*8+1:ifa%=sd%(0)ord=2thenreturn
1320 a=1
1325 a%=rnd(0)*8+1:b%=gl%(0)+sa%(a%)
1330 ifb%>9andb%<90thengl%(0)=b%:gosub1465:goto1345
1335 a=a+1:ifa<5then1325
1340 return
1345 ms$="[211]torm path causes course change.":gosub5206:sd%(0)=a%:goto1415
1350 rem ***** losses *****
1355 cn=2:gosub2005:rn%=rnd(9)*2+1:ifrn%=2then1358
1356 ms$="[211]torm damage to "+str$(c%)+" vessel(s).":ifsp%(0)>1thensp%(0)=sp%(0)-1
1357 ds%(0)=ds%(0)+c%:goto1360
1358 ms$="[211]torm sinks"+str$(c%)+" vessel(s).":ev%(0)=ev%(0)-c%
1360 gosub5206:gosub1410:gosub1420:gosub1425
1361 gosub6020:gosub5034:ife=3then1270
1362 return
1365 forf=1toc%:cn=3:gosub2005:nextf
1366 ms$="[213]boats sink "+str$(c%)+" chaser(s).":ev%(0)=ev%(0)-c%:gosub5206
1367 gosub1410:gosub6020:goto5034
1370 rem ***** hq alert *****
1375 ms$="[198]8 = [200][209] obstacle reports.":v=18:goto5210
1380 rem ***** fuel consumption *****
1385 mf%=z*(4-ra%(0)):goto1394
1390 mf%=sp%(0)
1394 qf=1:fc%(0)=fc%(0)+mf%:fu%(0)=(1000-fc%(0))*100/1000
1395 iffu%(0)<1thenfu%(0)=0:qf=4
1396 q=0:a%=0:goto1475
1400 rem ***** print status data *****
1405 a$=str$(we%(1)):v=6:goto1435
1406 a$=str$(we%(2)):v=7:goto1435
1410 a$=str$(ev%(0)):v=8:goto1435
1415 a$=sd$(sd%(0)):v=9:goto1435
1420 a$=sp$(sp%(0)):v=10:goto1435
1425 a$=str$(ds%(0)):v=11:goto1435
1430 a$=str$(us%(0)):v=12
1435 h=31:ms$=" ":gosub5070:ms$=a$:goto5070
1440 rem ***** print status line *****
1445 gosub5040:forx=1to3:h=dl%(x):ms$=dl$(x):gosub5070:next
1450 a%=1:q=8
1455 ona%goto1460,1465,1475
1460 h=9:e$=" ":a$=str$(se%(0)):goto1480
1465 h=20:e$=" ":a$=gl$(gl%(0)):goto1480
1475 h=32:e$=" ":a$=str$(fu%(0)):goto1480
1480 v=0:ms$=e$:gosub5070:ms$=a$:gosub5070:ifq<>8thenreturn
1485 a%=a%+1:ifa%<4then1455
1490 q=0:a%=0:return
1500 rem ***** set/unset problem locations *****
1505 pl%=4-ra%(0):ss=0:ms$="[210]eviewing situation - be patient.":gosub5205
1510 a%=ra%(0):ot=ot+1:ifot>3thenot=1
1511 rn%=rnd(0)*48+1
1512 onotgoto1515,1520,1525
1515 st%(rn%)=0:l1%(rn%)=0:a%=a%-1:ifa%=0then1530
1516 goto1511
1520 ub%(rn%)=0:l2%(rn%)=0:a%=a%-1:ifa%=0then1530
1521 goto1511
1525 ds%(0)=ds%(0)-ra%(0):ifds%(0)=<0thends%(0)=0
1526 gosub1425
15